<template>
  <div class="home"> {{ $t("home.name") }}</div>
  <button @click="andFn">点击切换语言</button>
</template>

<script lang="ts">
import i18n from '@/i18n/index'
  export default{
    setup(){
      function andFn(){
        if(i18n.global.locale == 'zhCn'){
          i18n.global.locale = 'en'
        }else{
          i18n.global.locale = 'zhCn'
        }
      } 
      return{
        andFn
      }
    }
  }
</script>

